<!DOCTYPE html>  
<html>
<meta charset="utf-8" />  
<title>字符串出现最多的字母</title>  
<script language="javascript"type="text/javascript">  
    var str = 'afjghdfraaaasdenas';
	var obj={}

	for(let i=0;i<str.length;i++){
		var vl = str[i]
		if(obj[vl]&&obj[vl].vl==vl){
			obj[vl].num ++
		}else{
			obj[vl]={};
			obj[vl].vl = vl;
			obj[vl].num = 1
		}
	} 

    console.log(obj)
</script>  
<body>
<h2>WebSocket Test</h2>  
<div id="output"></div>  
</body>
</html>